//
//  DFProductGroupModel.swift
//  DailyFresh
//
//  Created by Arthur on 2017/9/26.
//  Copyright © 2017年 DailyFresh. All rights reserved.
//  Group类型的Model

import UIKit
import SwiftyJSON
/*
 
 "code": "daojishi",
 "group_img": null,
 "backgroud_color": 0,
 "enabled_banner": 1,
 "type": "group",
 "tags": null,
 "gray_switch": 0,
 "font_color": 16719167,
 "second_title": null,
 "name": "今日特卖",
 "seckill_bgimg_url": "http://missfresh-asvip-production-common.ufile.ucloud.com.cn/category_group_images/6AC27A0A72379767FFF7C13EB4B004B4.PNG",
 "act_end_time": 29756,
 "right_image": null,
 "left_image": null
 
 */
class DFProductGroupModel: DFProductBaseModel {
    
    var code: String = ""
    var seckill_bgimg_url: String = ""
    var name: String = ""
    var second_title: String = ""
    
    var bannerArray: Array<DFGroupBannerModel> = []
    
    override init(json: JSON) {
        super.init(json: json)
        seckill_bgimg_url = json["seckill_bgimg_url"].stringValue
        name = json["name"].stringValue
        code = json["code"].stringValue
        second_title = json["second_title"].stringValue
        
        let banners = json["banner"].arrayValue
        
        bannerArray = banners.map { (bJson) -> DFGroupBannerModel in
            let b = DFGroupBannerModel.init(json: bJson)
            return b
        }
        
    }
}
